1. Field of the Invention
This invention relates generally to electronic networks, and more a particularly to a system and method for context switching in an electronic network.
2. Description of the Background Art
Implementing an effective method for managing communications between electronic devices within an electronic network is a significant consideration of designers, manufacturers, and users of electronic devices. An electronic device in an electronic network may advantageously communicate with other electronic devices in the network to share data and substantially increase the resources available to individual devices in the network. For example, an electronic network may be implemented in a user""s home to enable flexible and beneficial sharing of resources between various consumer electronic devices, such as personal computers, digital video disc (DVD) devices, digital set-top boxes for digital broadcasting, television sets, and audio playback systems.
An electronic device in an electronic network may alternately receive or transmit data across the network. Therefore, an electronic device may be required to function both as a transmitter and a receiver of data. In such a case, the electronic device may be required to switch between a transmit mode and a receive mode, that is, to switch contexts. Context switching is especially important in electronic networks where each device in the network has a combined input/output interface with the network. Since data may be transmitted and received via the same interface, such a device may not transmit data and receive data at the same time. Therefore, a device may need to switch contexts to effectively communicate with other devices in the network.
In some types of electronic networks, electronic devices may be xe2x80x9cdaisy-chained,xe2x80x9d so that the devices are directly connected to one another in a tree-like structure instead of being connected to a common network bus structure. In such a network, data being delivered via the bus may pass through various intermediary devices before arriving at the destination device. An intermediary device, in a receive context, may receive data and then switch to a transmit context to transmit the data to another device. Alternately, an intermediary device may transmit data to a destination device in a transmit context, and then switch to a receive context to function as a destination device for different data.
In some electronic networks, when a device is currently preparing to transmit data on the bus, the device typically is not able to receive data at the same time. However, if the device does not receive the data intended for it, that data may be lost. Loss of data may especially be a problem in a situation where the source of the data is a broadcast signal that cannot be repeated if the data is not received. Therefore, effective and efficient context switching is needed to prevent loss of data being sent across the network.
Context switching in an electronic network should be as efficient as possible to maintain effective communications across the network. Therefore, managing communications between electronic devices in an electronic network remains a significant consideration for designers, manufacturers, and users of electronic devices.
In accordance with the present invention, a system and method are disclosed for implementing context switching in an electronic network. In one embodiment, the invention includes a memory configured to store instruction modules, each instruction module corresponding to a context, a processor that executes the instruction modules, and a control state machine. The control state machine selects one of the instruction modules for execution by the processor according to context information from the electronic network.
Each instruction module stored in the memory corresponds to a context. The contexts may include a cycle start context, a transmit context, or a receive context. The memory preferably stores a cycle start context instruction module, a transmit context instruction module, and a receive context instruction module for each data channel supported by the electronic network. The control state machine selects one of the instruction modules in response to context information contained in data packet headers received from the electronic network.
The control state machine preferably includes a switch address generator, a return address register, and a program counter select. The switch address generator outputs a switch address, which is an address for a first instruction of the instruction module corresponding to a selected context. The return address register stores a return address, which is an address of a next consecutive instruction of an interrupted instruction module. The program counter select outputs the switch address, the return address, or a next consecutive address to select the appropriate instruction in the memory for execution by the processor.
The switch address generator includes a cycle start address register, a transmit address register, and a receive address register. The cycle start address register stores an address for a first instruction of a cycle start instruction module. The transmit address register stores an address for a first instruction for a transmit instruction module. The receive address register stores addresses for first instructions for receive instruction modules. The receive instruction modules include a receive instruction module for each data channel supported by the electronic network.
Execution of an instruction module may be interrupted when a context switch occurs. The return address register stores the return address so that execution of the interrupted instruction module may be resumed at the point where the interruption occurred. The present invention thus efficiently and effectively implements a system and method for context switching in an electronic network.